/**
 * 手机号码
 * @param {*} s
 */
export function isPhone(s: string): boolean {
    return /^1[0-9]{10}$/.test(s)
}
/**
 * 验证是否为手机号或固话
 * @param s
 * @return {boolean}
 */
export function isPhoneOrTel(s: string): boolean {
    return /^([0-9]{3,4}-)?[0-9]{5,8}$/.test(s) || /^1[0-9]{10}$/.test(s)
}

/**
 * 验证值是否为空
 * @param s
 * @return {boolean}
 */

export function isEmptyValue(value: any) {
    if (value === undefined || value === null) {
        return true
    }
    if (Array.isArray(value) && !value.length) {
        return true
    }
    if (typeof value === 'string' && !value) {
        return true
    }
    return false
}

/**
 * 验证是否为数组
 * @param s
 * @return {boolean}
 */
export function isEffectArray<T>(value: unknown): value is Array<T> {
    return Array.isArray(value) && value.length > 0
}


export function isVideoFile(string: string): boolean {
    return ['avi', 'wmv', 'mpg', 'mpeg', 'mov', 'rm', 'ram', 'swf', 'flv', 'mp4', 'mp3', 'wma', 'avi', 'rm', 'rmvb', 'flv', 'mpg', 'mkv'].includes(string.toLowerCase())
}


export function isVideoMimeType(string: string): boolean {
    return new RegExp(/video\/.+/g).test(string)
}
